<!DOCTYPE html>
<html>
<head>
    <title>测试平台商品分类关联功能</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
    <h1>测试平台商品分类关联功能</h1>
    
    <h2>1. 测试商品分类API</h2>
    <button onclick="testCategoryAPI()">测试商品分类列表</button>
    <div id="categoryResult"></div>
    
    <h2>2. 测试平台商品API</h2>
    <button onclick="testPlatformAPI()">测试平台商品列表</button>
    <div id="platformResult"></div>
    
    <h2>3. 测试关联查询</h2>
    <button onclick="testJoinQuery()">测试关联查询</button>
    <div id="joinResult"></div>

    <script>
        function testCategoryAPI() {
            fetch('http://localhost:8080/dianpu/classify/list?pageNum=1&pageSize=10')
                .then(response => response.json())
                .then(data => {
                    document.getElementById('categoryResult').innerHTML = 
                        '<h3>商品分类列表:</h3><pre>' + JSON.stringify(data, null, 2) + '</pre>';
                })
                .catch(error => {
                    document.getElementById('categoryResult').innerHTML = 
                        '<h3>错误:</h3><pre>' + error.message + '</pre>';
                });
        }

        function testPlatformAPI() {
            fetch('http://localhost:8080/dianpu/platform/list?pageNum=1&pageSize=10')
                .then(response => response.json())
                .then(data => {
                    document.getElementById('platformResult').innerHTML = 
                        '<h3>平台商品列表:</h3><pre>' + JSON.stringify(data, null, 2) + '</pre>';
                })
                .catch(error => {
                    document.getElementById('platformResult').innerHTML = 
                        '<h3>错误:</h3><pre>' + error.message + '</pre>';
                });
        }

        function testJoinQuery() {
            fetch('http://localhost:8080/dianpu/platform/list?pageNum=1&pageSize=5&categoryId=1')
                .then(response => response.json())
                .then(data => {
                    document.getElementById('joinResult').innerHTML = 
                        '<h3>按分类ID查询结果:</h3><pre>' + JSON.stringify(data, null, 2) + '</pre>';
                })
                .catch(error => {
                    document.getElementById('joinResult').innerHTML = 
                        '<h3>错误:</h3><pre>' + error.message + '</pre>';
                });
        }
    </script>
</body>
</html> 